#include <iostream>
#include <vector>

using namespace std;

class Solution 
{
public:
    void moveZeroes(vector<int>& nums) 
    {
        for (int cur = 0, dest = -1; cur < nums.size(); cur++)
        {
            if (nums[cur])
            {
                swap(nums[++dest], nums[cur]);
            }

        }
    }
};

int main()
{
    vector<int> nums{ 0, 1, 0, 3, 12 };
    Solution xz;
    xz.moveZeroes(nums);
    for (auto e : nums)
    {
        cout << e << " ";
    }

    return 0;
}
